package com.wangshouyu.mp.micro.phone;

import com.wangshouyu.mp.micro.base.utils.DecryptUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author 王守钰
 * @description 小程序绑定手机号请求工具
 * @date 2020/8/19 10:47
 */
public class MicroBindPhoneUtils {

    private static Logger log = LoggerFactory.getLogger(MicroBindPhoneUtils.class);

    /**
     * 解密手机号码
     * @param request 加密请求
     * @return 解密手机号
     */
    public static String decryptPhone(MicroBindPhoneRequest request){
        log.info("decrypt phone request: {}", request);
        return DecryptUtils.decryptData(request.getEncryptedData(), request.getSessionKey(), request.getIv());
    }
}
